package com.dongling.system.api;

import com.dongling.system.api.domain.SysRole;
import com.dongling.common.core.web.controller.BaseController;
import com.dongling.system.api.domain.SysUser;
import com.dongling.system.service.ISysRoleService;
import com.dongling.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/toFlowableFeign")
public class ToFlowableController extends BaseController {
    @Autowired
    private ISysRoleService roleService;

    @Autowired
    private ISysUserService userService;


    @PostMapping("/roleList")
    public List<SysRole> listRole(@RequestBody SysRole role)
    {
        startPage();
        List<SysRole> list = roleService.selectRoleList(role);
        return list;
    }

    @PostMapping("/userList")
    public List<SysUser> listUser(@RequestBody SysUser user)
    {

        List<SysUser> list = userService.selectUserList(user);
        return list;
    }

    @PostMapping("/selectUserById/{userId}")
    public SysUser selectUserById(@PathVariable("userId") Long userId)
    {
        return userService.selectUserById(userId);
    }

    @PostMapping("/selectRoleById/{roleId}")
    public SysRole selectRoleById(@PathVariable("roleId") Long roleId)
    {
        return roleService.selectRoleById(roleId);
    }

}
